/*******************************************************************************
 * Copyright (c) Jonathan Buck - jonbuck16@gmail.com
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    jonbuck16@gmail.com - initial API and implementation
 *******************************************************************************/
package net.jonbuck.tassoo.ui.preference;

import net.jonbuck.tassoo.model.Status;

import org.apache.commons.lang.math.NumberUtils;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerComparator;

/**
 * 
 * 
 * @since 1.0.0
 */
public class StatusPreferenceComparator extends ViewerComparator {

	/**
	 * 
	 */
	public int compare(Viewer viewer, Object e1, Object e2) {
		Status statusOne = (Status) e1;
		Status statusTwo = (Status) e2;
		return NumberUtils.compare(statusOne.getAssociatedPercentage(), statusTwo.getAssociatedPercentage());
	}

}
